/*
 * name: mabel xu
 * date: february 25, 2008
 * filename: StudentComparator.java
 * description: compare two StudentID
 */

import java.util.*;	// Comparator interface

public class StudentComparator implements Comparator
{
	// gets two StudentID as objects and compares them based on last, then first name
	public int compare(Object first, Object second)
	{
		StudentID a = (StudentID) first;
		StudentID b = (StudentID) second;

		if (a.getLName().compareTo(b.getLName()) != 0)	// compare by last name ...
			return a.getLName().compareTo(b.getLName());
		else
			if (a.getFName().compareTo(b.getFName()) != 0)	// ... then by first name
				return a.getFName().compareTo(b.getFName());
			else
				return 0;
	}	// end compare method
}